package com.eleven.trades.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.eleven.trades.entity.Flow;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author linhaizeng
 */
public interface FlowMapper extends BaseMapper<Flow> {
    /**
     * 查询业务流水信息
     * @param in_id
     * @return
     */
    @Select("select flow_id,in_id,out_id,flow_amount,flow_status,note,start_time,end_time from flow where in_id=#{in} or out_id=#{in}")
    List<Flow> selectByAccountId(@Param("in") String in_id);

    /**
     * 查询来往交易
     * @param in_id
     * @param out_id
     * @return
     */
    @Select("select flow_id,in_id,out_id,flow_amount,flow_status,note,start_time,end_time from flow where (in_id=#{in} and out_id=#{out}) or (in_id=#{out} and out_id=#{in})")
    List<Flow> selectByTransId(@Param("in")String in_id , @Param("out")String out_id);
}
